<?php /*
 * FCKeditor - The text editor for internet
 * Copyright (C) 2003-2005 Frederico Caldeira Knabben
 * 
 * Licensed under the terms of the GNU Lesser General Public License:
 * 		http://www.opensource.org/licenses/lgpl-license.php
 * 
 * For further information visit:
 * 		http://www.fckeditor.net/
 * 
 * File Name: commands.php
 * 	This is the File Manager Connector for ASP.
 * 
 * File Authors:
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
 */

function GetFolders( $resourceType, $currentFolder )
{	global $session;	$currentFolder = substr($currentFolder,1);
	$query = "SELECT r1.nom FROM html_repertoire As r1,html_repertoire As r2,hierarchie";	$query.= " WHERE r2.path='$currentFolder'";	$query.= " AND r1.droit=hierarchie.id_groupe";	$query.= " AND hierarchie.id_groupe_dessus='".$session['id_groupe']."'";	$query.= " AND r2.id=r1.id_parent ORDER BY r1.nom";
	include(realpath("../../../../../../../sql/sql_config.inc.php"));	$cnx = @mysql_connect($sql_serveur,$sql_login,$sql_pass);    $base = @mysql_select_db($sql_base);    $result = mysql_query($query);	// Open the "Folders" node.	echo "<Folders>" ;
	while ( $row= mysql_fetch_array($result) )
	{
		echo '<Folder name="' . ConvertToXmlAttribute( $row['nom'] ) . '" />' ;	}

	@mysql_free_result($result);	@mysql_close($cnx);
	// Close the "Folders" node.
	echo "</Folders>" ;}

function GetFoldersAndFiles( $resourceType, $currentFolder )
{	global $session;	$currentFolder = substr($currentFolder,1);	$query = "SELECT r1.nom FROM html_repertoire As r1,html_repertoire As r2,hierarchie";	$query.= " WHERE r2.path='$currentFolder'";	$query.= " AND r1.droit=hierarchie.id_groupe";	$query.= " AND hierarchie.id_groupe_dessus='".$session['id_groupe']."'";	$query.= " AND r2.id=r1.id_parent ORDER BY r1.nom";		include(realpath("../../../../../../../sql/sql_config.inc.php"));	$cnx = @mysql_connect($sql_serveur,$sql_login,$sql_pass);    $base = @mysql_select_db($sql_base);    $result = mysql_query($query);	// Initialize the output buffers for "Folders" and "Files".
	$sFolders	= '<Folders>' ;
	$sFiles		= '<Files>' ;
//	$sFolders .= '<Folder name="' . ConvertToXmlAttribute( 'Rodrigue' ) . '" />' ;//	$sFiles	.= '<File name="' . ConvertToXmlAttribute( 'test' ) . '" size="0" />' ;
	while ( $row= mysql_fetch_array($result) )	{		$sFolders .= '<Folder name="' . ConvertToXmlAttribute( $row['nom'] ) . '" />' ;	}	@mysql_free_result($result);		$query = "SELECT h.nom,h.titre FROM html As h,html_repertoire As r,hierarchie";	$query.= " WHERE r.path='$currentFolder'";	$query.= " AND h.droit=hierarchie.id_groupe";	$query.= " AND hierarchie.id_groupe_dessus='".$session['id_groupe']."'";	$query.= " AND r.id=h.id_repertoire";	$result = mysql_query($query);	while ( $row= mysql_fetch_array($result) )	{		$sFiles .= '<File name="' . ConvertToXmlAttribute( $row['nom'] ) . '" titre="' . ConvertToXmlAttribute( $row['titre'] ) . '" />' ;	}	@mysql_free_result($result);	@mysql_close($cnx);
	echo $sFolders ;	// Close the "Folders" node.
	echo '</Folders>' ;

	echo $sFiles ;
	// Close the "Files" node.
	echo '</Files>' ;}


?>